package com.huike.game.Activity;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.huike.game.R;

import androidx.appcompat.app.AppCompatActivity;

public class GameActivity55 extends AppCompatActivity {

    private ImageView iv_left_image;
    private TextView tv_left_text;
    private TextView tv_content_title;
    private ImageView iv_rigth_image;
    private TextView tv_right_text;
    private WebView wv_game55;
    private ProgressBar pb_game55;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game55);
        initView();


//        wv_game55.loadUrl("file:///android_asset/index.html");//加载本地
        wv_game55.setWebViewClient(new WebViewClient(){//使用内部浏览器
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });

        wv_game55.loadUrl("http://www.baidu.com");

        wv_game55.setWebChromeClient(new WebChromeClient(){//网页加载进度
            @Override
            public void onProgressChanged(WebView view, int newProgress) {

                if(newProgress == 100){
                    pb_game55.setVisibility(View.GONE);
                }else{
                    pb_game55.setProgress(newProgress);
                }

            }
        });


    }


    private void initView() {
        iv_left_image = (ImageView) findViewById(R.id.iv_left_image);
        tv_left_text = (TextView) findViewById(R.id.tv_left_text);
        tv_content_title = (TextView) findViewById(R.id.tv_content_title);
        iv_rigth_image = (ImageView) findViewById(R.id.iv_rigth_image);
        tv_right_text = (TextView) findViewById(R.id.tv_right_text);
        wv_game55 = findViewById(R.id.wv_game55);
        pb_game55 = findViewById(R.id.pb_game55);


        iv_rigth_image.setVisibility(View.GONE);
        tv_right_text.setVisibility(View.GONE);

        tv_content_title.setText("webView");

        iv_left_image.setImageResource(R.drawable.tiao);
        tv_left_text.setVisibility(View.GONE);

    }
}
